﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Chapter_5
{
    class Program
    {
        static void Main(string[] args)
        {
            //Person[] myPersons = {new Person("A","B")};
            //Console.WriteLine(myPersons[0].LastName);
            UseArray();
        }

        //use array
        static void UseArray()
        {
            Array myArray = Array.CreateInstance(typeof(int), 4);
            myArray.SetValue(5, 2);
            int[] myArray2 = (int[])myArray.Clone();
            
            myArray2[2] = 6;
            //myArray.SetValue(5, 2);
            int[] a1 = { 1, 2 };
            int[] a2 = (int[])a1.Clone();
            a2[0] = 5;
            
            int index = Array.IndexOf(myArray, 2);
            Console.WriteLine("{0}\n{1}",myArray.GetValue(2),myArray2[2]);
            Console.WriteLine("{0}\n{1}", a1[0], index);
            //Console.WriteLine("{0}\n{1}",myArray.GetType(), a1.GetType());
            HelloCollection h = new HelloCollection();
            foreach (string s in h)
            {
                Console.WriteLine(s);
            }
        }
    }
}
